Skip to content

ARM64: Display method names for indirect calls in JitDisasm output#126000

Merged
EgorBo merged 6 commits intomainfrom
copilot/jit-release-jitdisasm-function-names-arm64
Mar 30, 2026
Merged

ARM64: Display method names for indirect calls in JitDisasm output#126000
EgorBo merged 6 commits intomainfrom
copilot/jit-release-jitdisasm-function-names-arm64

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Description

ARM64 JitDisasm output for indirect calls (blr/br_tail) was missing method name annotations. On x64, indirect calls render as call [addr] ; MethodName, but on ARM64 the equivalent blr x2 had no function name comment.

The method handle is already stored in idMemCookie for all call types. The IF_BR_1B display case in emitDispInsHelp simply never read it.

Before:

            blr     x2

After:

            blr     x2      // code for IndirectCallAnnotation:VirtualCallee():int

Changes

  • src/coreclr/jit/emitarm64.cpp: In the IF_BR_1B case of emitDispInsHelp, call emitDispCommentForHandle with GTF_ICON_FTN_ADDR to display the method name — matching the format used by movz/movk constant annotations in checked builds and the convention used by other architectures.
Original prompt

This section details on the original issue you should resolve

<issue_title>JIT: Release JitDisasm does not include function names for calls on arm64</issue_title>
<issue_description>E.g. I see

; Assembly listing for method vb_playground.M1:Main() (FullOpts)
; Emitting BLENDED_CODE for arm64 on Apple
; FullOpts code
; optimized code
; fp based frame
; partially interruptible
; No PGO data
; 0 inlinees with PGO data; 2 single block inlinees; 0 inlinees without PGO data

G_M000_IG01:                ;; offset=0x0000
            stp     fp, lr, [sp, #-0x10]!
            mov     fp, sp

G_M000_IG02:                ;; offset=0x0008
            movz    x0, #0x2570
            movk    x0, #0x99F LSL dotnet/runtime#16
            movk    x0, dotnet/runtime#1 LSL dotnet/runtime#32
            bl      CORINFO_HELP_NEWSFAST
            mov     w1, dotnet/runtime#3
            movz    x2, #0x7C00
            movk    x2, dotnet/runtime#590 LSL dotnet/runtime#16
            movk    x2, dotnet/runtime#1 LSL dotnet/runtime#32
            ldr     x2, [x2]
            blr     x2

G_M000_IG03:                ;; offset=0x0030
            ldp     fp, lr, [sp], #0x10
            ret     lr

; Total bytes of code 56

when using JitDisasm on preview3. I would expect a comment with the function name for x2 (IIRC that was the primary reason we did work to store debug info in this case)

cc @dotnet/jit-contrib </issue_description>

<agent_instructions>Please improve JitDisasm for arm64 for Release. Most (if not all) managed-to-managed calls are indirect, but on x64 we render them as call [Foo] while on arm64 we do what is described in the issue with no function name. Please write a small FILECHECK test for arm64 specifically.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 24, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copilot AI and others added 2 commits March 24, 2026 00:30
…ail)

In the IF_BR_1B case of emitDispInsHelp, after displaying the register,
check if idMemCookie is set and display the method name as a comment.
This matches x64 behavior where indirect calls show the target method name.

Also add a small FileCheck test for ARM64 specifically.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b2a47cb3-cb3d-4479-a881-733d20b8576b
Copilot AI changed the title [WIP] Fix JIT release to include function names for calls on arm64 ARM64: Display method names for indirect calls in JitDisasm output Mar 24, 2026
Copilot AI requested a review from EgorBo March 24, 2026 00:37
@EgorBo EgorBo marked this pull request as ready for review March 24, 2026 01:08
Copilot AI review requested due to automatic review settings March 24, 2026 01:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates ARM64 JitDisasm output so indirect calls (blr / br_tail) include a method-name annotation comment, matching the existing behavior on other architectures. It also adds an ARM64 FileCheck-based JIT test to prevent regressions.

Changes:

  • ARM64: For IF_BR_1B instruction display, print the method name from idMemCookie as a // comment for indirect calls.
  • Tests: Add a new ARM64 disasm FileCheck test validating blr lines include the target method name annotation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/jit/emitarm64.cpp Adds method-name comment emission for IF_BR_1B (indirect branch/call register format) when idMemCookie is present.
src/tests/JIT/opt/Calls/IndirectCallAnnotation.csproj New JIT disasm/FileCheck-enabled test project configuration.
src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs New test that forces a virtual call and checks ARM64 disasm contains the callee method name on the blr instruction line.

Comment thread src/coreclr/jit/emitarm64.cpp Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/coreclr/jit/emitarm64.cpp Outdated
Comment thread src/tests/JIT/opt/Calls/IndirectCallAnnotation.cs Outdated
@EgorBo
Copy link
Copy Markdown
Member

EgorBo commented Mar 24, 2026

@copilot address the feedback.

Use emitDispCommentForHandle instead of directly calling eeGetMethodFullName
and printf, matching the pattern used by movz/movk constant annotations.

Remove the FileCheck test since it would only run in checked mode where
the method name already appears on the movz/movk constant instructions.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/84a22a2e-9c3e-40ef-ab3b-97113c002f92
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot address the feedback.

Addressed in 43bdb17 — switched to emitDispCommentForHandle and removed the test.

@EgorBo
Copy link
Copy Markdown
Member

EgorBo commented Mar 27, 2026

PTAL @dotnet/jit-contrib fix for JitDisasm

@EgorBo
Copy link
Copy Markdown
Member

EgorBo commented Mar 30, 2026

PTAL @jakobbotsch

@EgorBo EgorBo requested a review from jakobbotsch March 30, 2026 14:51
@EgorBo
Copy link
Copy Markdown
Member

EgorBo commented Mar 30, 2026

/ba-g "System.Formats.Nrbf.Tests timeout"

@EgorBo EgorBo enabled auto-merge (squash) March 30, 2026 20:28
@EgorBo EgorBo merged commit d023efe into main Mar 30, 2026
127 of 129 checks passed
@EgorBo EgorBo deleted the copilot/jit-release-jitdisasm-function-names-arm64 branch March 30, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Release JitDisasm does not include function names for calls on arm64

4 participants